﻿@model SimpleWidgetModel
@{
    ViewBag.Title = "CreateWidget";
    Layout = "~/Views/Shared/_Dashboard.cshtml";
}
@UIHelper.ImageTitle(Html.Global("CreateWidget"), Html.Global("CreateWidget_Desc"), "~/content/images/icon_puzzle_48.png")

@using (Html.BeginForm("CreateWidget", "Widget", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary()
    @UIHelper.SectionHeader(Html.Global("RES_VIEW_ENGINE") + "(" + Html.Global("RES_REQUIRED") + ")")
    <div>
        @Html.Global("CreateWidget_ViewEngineTips")
        <ul>
            <li>@Html.Global("CreateWidget_ViewEngine_Html")</li>
            <li>@Html.Global("CreateWidget_ViewEngine_ASPNET")</li>
            <li>@Html.Global("CreateWidget_ViewEngine_Razor")</li>
        </ul>
    </div>
    <div>
    </div>
    <table>
        <tr>
            <td>@Html.Global("RES_VIEW_ENGINE"):
            </td>
            <td>
                @(Ajax.Dna().ComboBox("ContentType")
                .Width(200)
            .Select((Model != null && !string.IsNullOrEmpty(Model.ContentType)) ? Model.ContentType : "html")
            .Items(items =>
            {
                items.AddValue("Html", "html");
                items.AddValue("ASP.NET Form", "ascx");
                items.AddValue("Razor(C#)", "cshtml");
                items.AddValue("Razor(VB)", "vbhtml");
            })
            .GetHtml())
            </td>
        </tr>
    </table>
    @UIHelper.SectionHeader(Html.Global("RES_CATEGORY") + "(" + Html.Global("RES_REQUIRED") + ")")
    <div>
        @Html.Global("CreateWidget_CategoyTips")</div>
    <table>
        <tr>
            <td>
                @Html.Global("RES_CATEGORY"):
            </td>
            <td>
                @(
 Ajax.Dna().ComboBox("Category")
            .Select((Model != null && !string.IsNullOrEmpty(Model.Category)) ? Model.Category : "Shared")
            .Width(200)
            .Bind(ViewBag.Categories)
            .GetHtml()
            )
            @{ Html.RegisterStartupScript("$(\"#Category\").prev(\"input\").bind(\"change\",function(){ $(\"#Category\").val($(this).val()); });");}
            </td>
            <td>@Html.ValidationMessageFor(m=>m.Category,"*")</td>
        </tr>
    </table>
    @UIHelper.SectionHeader(Html.Global("RES_NAME") + "(" + Html.Global("RES_REQUIRED") + ")")
    <div>
        @Html.Global("CreateWidget_NameTips")</div>
    <table>
        <tr>
            <td>
                @Html.Global("RES_NAME"):
            </td>
            <td>
                @Ajax.DnaFor().TextBox(m => m.Name).Name("Name").HtmlAttributes(Html.GetUnobtrusiveValidationAttributes("Name")).GetHtml()
            </td>
            <td>@Html.ValidationMessageFor(m=>m.Name,"*")</td>
        </tr>
    </table>
    @UIHelper.SectionHeader(Html.Global("RES_TITLE"))
    <div>
        @Html.Global("CreateWidget_TitleTips")</div>
    <table>
        <tr>
            <td>
                @Html.Global("RES_TITLE"):
            </td>
            <td>
                @Ajax.DnaFor().TextBox(m => m.Title).Name("Title").GetHtml()
            </td>
        </tr>
    </table>
    @UIHelper.SectionHeader(Html.Global("Widget_Icon"))
    <div>
        @Html.Global("CreateWidget_IconTips")</div>
    <table>
        <tr>
            <td>
                @Html.Global("Widget_Icon"):
            </td>
            <td>
                <input type="file" name="WidgetIconFile" />
            </td>
        </tr>
    </table>
    @UIHelper.SectionHeader(Html.Global("Widget_Image"))
    <div>
        @Html.Global("CreateWidget_ImageTips")</div>
    <table>
        <tr>
            <td>
                @Html.Global("Widget_Image"):
            </td>
            <td>
                <input type="file" name="Widget_Image" />
            </td>
        </tr>
    </table>
    @UIHelper.SectionHeader(Html.Global("RES_DESC"))
    <div>
        @Html.Global("CreaetWidget_DescTips")</div>
    @Ajax.DnaFor().TextArea(m => m.Description).Name("Description").Width(400).Resizable().GetHtml()
<hr />
<div style="text-align:center;">
@Ajax.Dna().Button().LocText("RES_CREATE").Submit().GetHtml()
</div>
}

